import requests
import json
from django.test import TestCase


headers = {"Content-Type": "application/json;charset=utf-8"}
payload = {
    "deploy_version": "2020-10-28-26HD",
    "app_name": "APP-BACKEND-JAVA",
    "ip_address": "192.168.10.1",
    "env_name": "TEST",
    "user_name": "utest",
    "operation_type": "deploy",
    "operation_no": 11,
    "log_content": "......2020-10-29 09:10:25 deploypkg 192.168.10.1, deploy progress 70%"
}

try:
    result = requests.post("http://127.0.0.1:8888/wslog/log_add/", headers=headers, data=json.dumps(payload))
    print(result.status_code)
except Exception as e:
    print(e)
print("OK!")


# http://127.0.0.1:8888/wslog/log_show/?app_name=APP-BACKEND-JAVA&deploy_version=2020-10-28-26HD&env_name=Demo&operation_no=11